package com.hq.xmind.controller;

import com.hq.xmind.service.XmindService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Api(tags = "统计管理")
@Controller
public class IndexController {

    @Autowired
    private XmindService xmindService;

    @GetMapping("/xxxx")
    @ApiOperation(value = "统计")
    public String index(HttpServletRequest request){
        long before = System.currentTimeMillis();
        request.setAttribute("treeJson",xmindService.getTreeJson());
        long after = System.currentTimeMillis();
        System.out.println("Time use is :" +(after-before) +".ms");
        return "index";
    }
}
